package com.tom.zojbackenduserservice.controller.inner;

import com.tom.zojbackendmodel.model.entity.User;
import com.tom.zojbackendserviceclient.service.UserFeignClient;
import com.tom.zojbackenduserservice.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Set;

@RestController
@RequestMapping("/inner")
public class UserInnerController implements UserFeignClient {
    @Resource
    UserService userService;

    @Override
    @GetMapping("/get/id")
    public User getById(@RequestParam("userId") long userId) {
        return userService.getById(userId);
    }

    @Override
    @GetMapping("/list/Ids")
    public List<User> listByIds(@RequestParam("userIds") Set<Long> userIds) {
        return userService.listByIds(userIds);
    }
}
